package com.zkthink.ceres.promotion.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.zkthink.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.zkthink.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 分销关系设置
 * </p>
 *
 * @author kellen
 * @since 2020-08-31
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ceres_sales_relation_config")
@ApiModel(value = "SalesRelationConfig", description = "分销关系设置")
@AllArgsConstructor
public class SalesRelationConfig extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 是有永久有效  1是 2否
     */
    @ApiModelProperty(value = "是有永久有效  1是 2否")
    @NotNull(message = "是有永久有效  1是 2否不能为空")
    @TableField("is_forever_valid")
    @Excel(name = "是有永久有效  1是 2否")
    private Integer isForeverValid;

    /**
     * 有效期
     */
    @ApiModelProperty(value = "有效期")
    @NotNull(message = "有效期不能为空")
    @TableField("expire_time")
    @Excel(name = "有效期")
    private Integer expireTime;

    /**
     * 是否允许抢客 1随时 2不允许 3某段时间之后允许
     */
    @ApiModelProperty(value = "是否允许抢客 1随时 2不允许 3某段时间之后允许")
    @NotNull(message = "是否允许抢客 1随时 2不允许 3某段时间之后允许不能为空")
    @TableField("rebind_customer_flag")
    @Excel(name = "是否允许抢客 1随时 2不允许 3某段时间之后允许")
    private Integer rebindCustomerFlag;

    /**
     * 允许抢客的保护期
     */
    @ApiModelProperty(value = "允许抢客的保护期")
    @NotNull(message = "允许抢客的保护期不能为空")
    @TableField("protect_time")
    @Excel(name = "允许抢客的保护期")
    private Integer protectTime;

    /**
     * 允许分销员之间建立客户关系 1：是 2否 
     */
    @ApiModelProperty(value = "允许分销员之间建立客户关系 1：是 2否 ")
    @NotNull(message = "允许分销员之间建立客户关系 1：是 2否 不能为空")
    @TableField("sales_bind_falg")
    @Excel(name = "允许分销员之间建立客户关系 1：是 2否 ")
    private Integer salesBindFalg;

    /**
     * 分销员自购返佣开关 1开 2关
     */
    @ApiModelProperty(value = "分销员自购返佣开关 1开 2关")
    @NotNull(message = "分销员自购返佣开关 1开 2关不能为空")
    @TableField("self_buy_return_commision_flag")
    @Excel(name = "分销员自购返佣开关 1开 2关")
    private Integer selfBuyReturnCommisionFlag;

    /**
     * 分销员申请条件 1购买任意商品 2下单数 3消费金额
     */
    @ApiModelProperty(value = "分销员申请条件 1购买任意商品 2下单数 3消费金额")
    @NotNull(message = "分销员申请条件 1购买任意商品 2下单数 3消费金额不能为空")
    @TableField("apply_condition")
    @Excel(name = "分销员申请条件 1购买任意商品 2下单数 3消费金额")
    private Integer applyCondition;

    /**
     * 审核设置 1无需审核 2需要审核
     */
    @ApiModelProperty(value = "审核设置 1无需审核 2需要审核")
    @NotNull(message = "审核设置 1无需审核 2需要审核不能为空")
    @TableField("audit_flag")
    @Excel(name = "审核设置 1无需审核 2需要审核")
    private Integer auditFlag;

    /**
     * 满足的具体条件
     */
    @ApiModelProperty(value = "满足的具体条件")
    @NotNull(message = "满足的具体条件不能为空")
    @TableField("apply_detail")
    @Excel(name = "满足的具体条件")
    private Long applyDetail;

    /**
     * 是否允许邀请下级 1是 2否
     */
    @ApiModelProperty(value = "是否允许邀请下级 1是 2否")
    @NotNull(message = "是否允许邀请下级 1是 2否不能为空")
    @TableField("is_can_invite")
    @Excel(name = "是否允许邀请下级 1是 2否")
    private Integer isCanInvite;

    /**
     * 逻辑删除 1-删除 0-未删除
     */
    @ApiModelProperty(value = "逻辑删除 1-删除 0-未删除")
    @NotNull(message = "逻辑删除 1-删除 0-未删除不能为空")
    @TableField("is_delete")
    @Excel(name = "逻辑删除 1-删除 0-未删除")
    private Integer isDelete;


    @Builder
    public SalesRelationConfig(Long id, LocalDateTime updateTime, Long updateUser, LocalDateTime createTime, Long createUser, 
                    Integer isForeverValid, Integer expireTime, Integer rebindCustomerFlag, Integer protectTime, Integer salesBindFalg, 
                    Integer selfBuyReturnCommisionFlag, Integer applyCondition, Integer auditFlag, Long applyDetail, Integer isCanInvite, Integer isDelete) {
        this.id = id;
        this.updateTime = updateTime;
        this.updateUser = updateUser;
        this.createTime = createTime;
        this.createUser = createUser;
        this.isForeverValid = isForeverValid;
        this.expireTime = expireTime;
        this.rebindCustomerFlag = rebindCustomerFlag;
        this.protectTime = protectTime;
        this.salesBindFalg = salesBindFalg;
        this.selfBuyReturnCommisionFlag = selfBuyReturnCommisionFlag;
        this.applyCondition = applyCondition;
        this.auditFlag = auditFlag;
        this.applyDetail = applyDetail;
        this.isCanInvite = isCanInvite;
        this.isDelete = isDelete;
    }

}
